﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pattern_Decorator
{
    public enum ComponentTypes { Org,DA,DB,DADB,DBDA};

    public class ComponentFactory
    {
        public static Component Create(ComponentTypes types)
        {
            Component compontent = new ConcreteComponent();
            ConcreteDecoratorA decorator_a = new ConcreteDecoratorA();
            ConcreteDecoratorB decorator_b = new ConcreteDecoratorB();

            switch (types)
            { 
                case ComponentTypes.Org:
                   return compontent;
                    
                case ComponentTypes.DA:
                    decorator_a.SetComponent(compontent);
                    return decorator_a;

                case ComponentTypes.DB:
                    decorator_b.SetComponent(compontent);
                    return decorator_b;

                case ComponentTypes.DADB:
                    decorator_a.SetComponent(compontent);
                    decorator_b.SetComponent(decorator_a);
                    return decorator_b;

                case ComponentTypes.DBDA:
                    decorator_b.SetComponent(compontent);
                    decorator_a.SetComponent(decorator_b);
                    return decorator_a;
                default:
                    return compontent;
            }
        }
    }
}
